<template>

  <div>

    <div v-for="item in allData" style="margin-bottom: 100vh">
      <div style="display: flex;justify-content: space-evenly;font-weight: bold;font-size: 24px">
        <p>姓名: {{item.name||0}}</p>
        <p>工天: {{item.days||0}}</p>
        <p>平方米: {{item.square_meter||0}}</p>
        <p>共预支: {{item.money||0}}</p>


      </div>


      <el-table
          :data="item.attendance_list"
          stripe
          border
      >
        <el-table-column
            prop="project_name"
            label="项目名"
        ></el-table-column>
        <el-table-column
            prop="date"
            label="时间"
        ></el-table-column>
        <el-table-column
            prop="days"
            label="工天"
        ></el-table-column>
        <el-table-column
            prop="square_meter"
            label="平方米"
        ></el-table-column>
        <el-table-column
            prop="location"
            label="地点"
        ></el-table-column>
        <el-table-column
            prop="type"
            label="工序"
        ></el-table-column>
        <el-table-column
            prop="user_name"
            label="姓名"
        ></el-table-column>
        <el-table-column
            prop="admin_name"
            label="管理员"
        ></el-table-column>
        <el-table-column
            label="状态"
        >
          <template slot-scope="scope">
            <!--            {{ scope.row.admin_approved | cardStatus }}-->

            <el-tag v-if="scope.row.admin_approved==0"  type="info">
              未审核
            </el-tag>
            <el-tag v-if="scope.row.admin_approved==1"  type="warning">
              已审核
            </el-tag>
            <el-tag v-if="scope.row.admin_approved==2" type="success">
              已计入
            </el-tag>
            <el-tag
                v-if="scope.row.admin_approved==3"
                type="danger"
            >
              已驳回
            </el-tag>


          </template>
        </el-table-column>
      </el-table>
      <el-table
          :data="item.salary_list"
          style="width: 100%">
        <el-table-column
            prop="name"
            label="姓名"
            width="180">
        </el-table-column>
        <el-table-column
            prop="date"
            label="时间"
        >
        </el-table-column>
        <el-table-column
            prop="money"
            label="预支款"
        >
        </el-table-column>
        <el-table-column
            prop="remark"
            label="描述"
        >
        </el-table-column>
      </el-table>
    </div>
















  </div>







</template>
<script>

export default  {
  data() {
    return {
      allData:{},
    }
  },
  methods: {
    getPunchCardSalary(){
      //结束router参数
      console.log(this.$route)
      const { params } = this.$route

      if (params.start){
      localStorage.setItem('start',params.start)
      localStorage.setItem('end',params.end)


      }
      const
      start = localStorage.getItem('start'),
      end = localStorage.getItem('end');




      // /admin/auth/getPunchCardSalary
      this.$http(`/admin/auth/getPunchCardSalary?start=${start}&end=${end}`).then(res => {
        console.log(res)
        if (res.data.status == 200) {
          this.allData = res.data.data
        } else {
          this.$message({
            type: 'error',
            message: res.data.message
          })
        }
      })




    }


  },
  mounted() {
    this.getPunchCardSalary()
  }
}



</script>

<style scoped lang="less">

</style>
